<template>
    <div>
        <el-table :data="tableData" style="width: 100%">

            <el-table-column prop="title" label="标题" width="180"/>
            <el-table-column prop="createTime" label="时间" width="180"/>
            <el-table-column prop="comment" label="内容" width="180"/>

            <el-table-column  label="操作" width="300">
                <template slot-scope="scope">
                    <el-button @click="changeState(scope.row,'1','通过')"  type="text" size="small">通过</el-button>
                    <el-button @click="changeState(scope.row,'0','拒绝')"  type="text" size="small">拒绝</el-button>
                </template>
            </el-table-column>

        </el-table>
    </div>
</template>

<script>
    export default {
        name: "lockApply",
        components:[],
        created() {
            this.$axios.get("/api/posts/getLockPostsApply")
                .then(req=>{
                    this.tableData = req.data.data;
                })
        },
        data(){
            return{
                tableData:[
                    {
                        id: 29,
                        userId: "2",
                        plateId: "3",
                        createTime: "2022-05-14 18:45:59",
                        title: "RNG 6-0",
                        comment: "6666",
                        state: "-1",
                        start: "0",
                        top: "0",
                        clock: "0"
                    }
                ]
            }
        },
        methods:{
            // 修改状态
            changeState(row,state,text){
                const tmp = row;
                tmp.clock = state;
                this.$axios.post("/api/posts/changePostsState",tmp)
                    .then(req=>{
                        this.$message.success(text);
                        location.reload();
                    })
            },
        }
    }
</script>

<style scoped>

</style>
